using System;
using System.Collections.Generic;
using System.Text;
using Spring.Dao.Support.Generic;
using Spring.Data.NHibernate.Generic.Support;
using System.Collections;

namespace Ghasam.Business.DAO
{
    public abstract class DaoBase<T> : HibernateDaoSupport, IDao<T>
    {

        public T FindById(object id)
        {
            return HibernateTemplate.Get<T>(id);
        }

        public IList<T> FindAll()
        {
            return HibernateTemplate.LoadAll<T>();
        }

        public T SaveOrUpdate(T entity)
        {
            HibernateTemplate.SaveOrUpdate(entity);
            return entity;
        }

        public void Delete(T entity)
        {
            HibernateTemplate.Delete(entity);
        }
    }
}
